/**
 * ProjectLayersAction.java
 *
 * Copyright (c) 2010 Prj.Manager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Prj.Manager .
 **/
package ro.prjmanager.web.actions;

import ro.prjmanager.core.annotations.*;
import ro.prjmanager.model.ProjectLayers;
import ro.prjmanager.web.annotation.NomenclatorTarget;
import ro.prjmanager.web.annotation.Service;

@Service(target = "projectlayersService")
@NomenclatorTarget(addTarget = "add",deleteTarget = "del",editTarget = "edit",
        resource = "/pages/nomenclators/projectlayers/projectlayers.jsp",
        onFaildReturn = "/pages/nomenclators/projectlayers/projectlayers.jsp")
@List(serviceName = "projectlayersService",
        caption = "ProjectLayers List",
        editUrl = "%context_path%/actions/ProjectLayers.action",
        id = "1", height = 200, rowNum = 10,
        url = "%context_path%/projectlayers.lst")
public class ProjectLayersAction extends GenericAction<ProjectLayers> {

    @Id
    private Long idL;

    @Column(name = "fkProject", caption = "Project", index = "fkProject", width = 250, editOptions = @EditOptions(pos = 2 ,required = true , prefix = "(*)" ,edittype = "select",size = 1 ))
    @SelectOption(id="fkProject",serviceName = "projectsService")
    private java.lang.Integer fkProject;

    @Column(name = "fkLayer", caption = "Layer", index = "fkLayer", width = 250, editOptions = @EditOptions(pos = 3 ,required = true , prefix = "(*)" ,edittype = "select",size = 1 ))
    @SelectOption(id="fkLayer",serviceName = "layersService")
    private java.lang.Integer fkLayer;

    @Column(name = "name", caption = "Name", index = "name", width = 250, editOptions = @EditOptions(pos = 4   ))
    private java.lang.String name;

    public Long getIdL() {
        if(getId()!=null&&!getId().isEmpty()&&!getId().equals("_empty"))
          idL=Long.valueOf(getId());
        return idL;
    }

    public void setIdL(Long idL) {
        this.idL = idL;
        if(idL!=null)
            this.setId(String.valueOf(idL));
    }

    /**
     * This method gets the fkProject attribute
     * @return - an  java.lang.Integer  object
     **/
    public  java.lang.Integer  getFkProject(){
        return this.fkProject;
    }

    /**
     * The setter for the fkProject attribute
     * @param fkProject -  an  java.lang.Integer  object
     **/
    public void setFkProject( java.lang.Integer  fkProject){
        this.fkProject=fkProject;
    }
    /**
     * This method gets the fkLayer attribute
     * @return - an  java.lang.Integer  object
     **/
    public  java.lang.Integer  getFkLayer(){
        return this.fkLayer;
    }

    /**
     * The setter for the fkLayer attribute
     * @param fkLayer -  an  java.lang.Integer  object
     **/
    public void setFkLayer( java.lang.Integer  fkLayer){
        this.fkLayer=fkLayer;
    }
    /**
     * This method gets the name attribute
     * @return - an  java.lang.String  object
     **/
    public  java.lang.String  getName(){
        return this.name;
    }

    /**
     * The setter for the name attribute
     * @param name -  an  java.lang.String  object
     **/
    public void setName( java.lang.String  name){
        this.name=name;
    }


    public void add() {
        ProjectLayers adderObj=getModel();
        getService().create(adderObj);

    }
    public void edit() {
         ProjectLayers editObj=getModel();
        getService().update(editObj);
    }

}
